home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 300 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.4 KB

  1. Path: tko.dec.com!diamond
  2. From: diamond@tko.dec.com (Norman Diamond)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Are macros expanded within unused macro arguments?
  5. Date: 5 Feb 1996 03:07:45 GMT
  6. Organization: Digital Equipment Corporation Japan , Tokyo
  7. Message-ID: <4f3sa2$8ue@usenet.pa.dec.com>
  8. References: <DM3MC3.Atv@scr.siemens.com> <TANMOY.96Feb1102025@qcd.lanl.gov> <4es8rp$98n@usenet.pa.dec.com> <4esiem$bbr@info.epfl.ch>
  9. Reply-To: diamond@jrdv04.enet.dec-j.co.jp (Norman Diamond)
  10. NNTP-Posting-Host: jit533.tko.dec.com
  11.  
  12. In article <4esiem$bbr@info.epfl.ch>, Thomas.Wolf@di.epfl.ch (Thomas Wolf) writes:
  13. >In article <4es8rp$98n@usenet.pa.dec.com>, diamond@tko.dec.com (Norman Diamond) writes:
  14. >>In article <TANMOY.96Feb1102025@qcd.lanl.gov>, tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes:
  15. >>>In article <DM3MC3.Atv@scr.siemens.com> mlg@scr.siemens.com (Michael Greenberg) writes: 
  16. >>>>Is the following program legal?
  17. >>>>#define foo(unused)
  18. >>>>#define bar(x,y)
  19. >>>>foo(bar(1))
  20.  
  21. >>>I read it as being legal.
  22.  
  23. >>Mr. Bhattacharya, I am shocked.
  24.  
  25. >Mr. Diamond, why are you shocked? Macro 'bar' is not invoked.
  26.  
  27. Now I see the point you are trying to make, but do not see any proof.
  28. Consider 6.8.3 itself (ANSI Classic 3.8.3 page 90 lines 35 to 37):
  29. "Each subsequent instance of the function-like macro name followed by a (
  30. as the next preprocessing token introduces the sequence of preprocessing
  31. tokens that is replaced by the replacement list in the definition (an
  32. invocation of the macro)."
  33. No exception or delay is suggested on account of being an argument of a
  34. different macro.  6.8.3.1 prevents a delay from being too long (in cases
  35. where the replacement would be used in the outer replacement) but does not
  36. do the opposite.
  37.  
  38. Hmm, I can see that this might be another defect in the standard, because
  39. it says that even the following definition of glitch will invoke bar:
  40. #define glitch bar(1)
  41. even if no other instance of glitch or bar occurs at all in the translation.
  42. However, this instance of the defect is somewhat more obvious than in the
  43. preceding case.  Perhaps the question cannot be answered at all until the
  44. standard is corrected.
  45. --
  46.  <<  If this were the company's opinion, I would not be allowed to post it.  >>
  47. "I paid money for this car, I pay taxes for vehicle registration and a driver's
  48. license, so I can drive in any lane I want, and no innocent victim gets to call
  49. the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
  50.